package com.bqtv.sport.ui.main

import android.content.Context
import android.content.Intent
import android.view.View
import com.bqtv.sport.R
import com.bqtv.sport.app.AppActivity
import com.bqtv.sport.databinding.ActivityLoginBinding
import com.bqtv.sport.databinding.ActivityPointsMallRulesBinding

class LoginActivity : AppActivity<ActivityLoginBinding>() {
    companion object {
        fun start(context: Context) {
            val intent = Intent(context, LoginActivity::class.java)
            context.startActivity(intent)
        }
    }
    var loginType=1

    override fun getViewBinding() = ActivityLoginBinding.inflate(layoutInflater)

    override fun initView() {

    }

    override fun initData() {


        initListener()
    }

    private fun initListener() {
        setOnClickListener(binding.tvLogin, binding.tvLoginType,binding.cvCode)
    }

    override fun onClick(view: View) {
        super.onClick(view)
        when (view) {
            binding.tvLogin -> {
                if (loginType==1){

                }
            }
            binding.tvLoginType -> {
                if (loginType==1) {
                    loginType=2
                    binding.tvLoginType.text=getString(R.string.psw_login)
                    binding.llCode.visibility= View.GONE
                    binding.llPsw.visibility= View.VISIBLE
                } else {
                    loginType=1
                    binding.tvLoginType.text=getString(R.string.code_login)
                    binding.llCode.visibility= View.VISIBLE
                    binding.llPsw.visibility= View.GONE
                }
            }
            binding.cvCode -> {
                binding.cvCode.start()
            }

        }
    }
}